<?php

namespace App\Http\Requests;

/**
 * 微信图文素材-保存验证类
 * @package App\Http\Requests
 */
class AdminWxMaterialNewsPost extends AdminBaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'material_data.cat_id' => 'required|numeric',
            'material_data.is_forever' => 'required|in:0,1',
            'news_list.*.title' => 'required',
            'news_list.*.author' => 'required',
            //'news_list.*.digest' => 'required',
            'news_list.*.thumb_view_url' => 'required|url',
            'news_list.*.content_source_url' => 'nullable|url',
            'news_list.*.news_click_url' => 'nullable|url',
            'news_list.*.content' => 'required',
        ];
    }

    /**
     * 自定义提示信息
     * @return array
     */
    public function messages()
    {
        return [
            'material_data.cat_id.required' => '请选择素材分类',
            'material_data.is_forever.required' => '请选择正确的素材类型',
            'material_data.is_forever.in' => '请选择正确的素材类型',
            'news_list.*.title.required' => '请务必确保所有图文标题非空',
            'news_list.*.author.required' => '请务必确保所有图文作者非空',
            //'news_list.*.digest.required' => '图文摘要为空',
            'news_list.*.thumb_view_url.required' => '请务必确保所有图文封面图非空',
            'news_list.*.content.required' => '请务必确保所有图文内容非空',
            'news_list.*.content_source_url.url' => '请务必确保所有阅读原文链接有效',
            'news_list.*.news_click_url.url' => '请务必确保所有图文的图文跳转地址有效',
        ];
    }
}
